Platform Explorer / Nuxeo Platform 2023.10

Component org.nuxeo.ecm.core.event.EventServiceComponent

Documentation

Event service

Resolution Order

143
The resolution order represents the order in which this component has been resolved by the Nuxeo Runtime framework.
You can influence this order by adding "require" tags in your component declaration, to make sure it is resolved after another component.

Start Order

10 (Declared Start Order: -500)
The start order represents the order in which this component has been started by the Nuxeo Runtime framework.
This number is interesting to tweak if your Java component interacts with other components, and needs to be started before or after another one.
It can be changed by implementing the method "Component#getApplicationStartedOrder()" on your Java component: components are sorted according to this reference value, in increasing order.
The default value is 1000, and the repository initialization uses number 100. Negative values can also be used.

Implementation

Class: org.nuxeo.ecm.core.event.EventServiceComponent

Services

Extension Points

Contributions

XML Source

<?xml version="1.0"?>
<component name="org.nuxeo.ecm.core.event.EventServiceComponent" version="1.0">
  <documentation>
    Event service
  </documentation>

  <implementation class="org.nuxeo.ecm.core.event.EventServiceComponent"/>

  <service>
    <provide interface="org.nuxeo.ecm.core.event.EventService"/>
    <provide interface="org.nuxeo.ecm.core.event.EventProducer"/>
    <provide interface="org.nuxeo.ecm.core.event.EventServiceAdmin"/>
  </service>

  <extension-point name="listener">
    <documentation>
      Extension point defining event listeners.

      An event listener describes some Java code that can be executed
      synchronously or asynchronously when an event is fired by Nuxeo code.

      Example listener:
      <code>
        <listener name="mylistener" enabled="true"
            postCommit="false" async="false"
            class="org.nuxeo.ecm.platform.dublincore.listener.DublinCoreListener"
            priority="50" retryCount="1">
          <event>documentCreated</event>
          <event>documentModified</event>
        </listener>
      </code>

      The events listed are those for which the listener will be called.
      If there are none, the listener is called for all events, but this is strongly
      discouraged for performance reasons.

      Listeners belong to one of three categories:

      If postCommit=false then the listener is purely synchronous
      (also called "inline") and executed in the same thread and transaction
      as the code firing the event, as a regular method call.
      The class must implement org.nuxeo.ecm.core.event.EventListener,
      which receives events one at a time.

      If postCommit=true and async=true then the listener is purely
      asynchronous and executed at an arbitrary later point in time
      (but after the original transaction is committed), in its own thread and transaction.
      It may be retried if a ConcurrentUpdateException is detected.
      The listener is executed asynchronously by the WorkManager via a Work instance
      whose category (which determines the Work queue used) is the listener's name.
      The class must implement org.nuxeo.ecm.core.event.PostCommitEventListener,
      which receives a bundle of all the events raised by the original transaction.

      If postCommit=true and async=false then the listener is executed synchronously
      immediately after the original transaction is committed, but in a separate transaction.
      It is not executed if the original transaction does a rollback.
      All listeners in this category are executed one after the other (in priority order),
      and only after they are all done does the main thread continue execution.
      (However if one of the listeners takes too long it is left to run purely asynchronously
      and the other listeners in this category are processed.)
      The class must implement org.nuxeo.ecm.core.event.PostCommitEventListener,
      which receives a bundle of all the events raised by the original transaction.

      The priority gives a global ordering of all the listeners
      in the same category executed for a given event.
      The default is 0.

      The retryCount specifies how many times a purely asynchronous listener
      may retry execution if it resulted in a ConcurrentUpdateException.
      The default is 1.
    </documentation>
    <object class="org.nuxeo.ecm.core.event.impl.EventListenerDescriptor"/>
  </extension-point>

  <extension-point name="pipe">
    <documentation>
      Extension point to contribute event pipe.

      An event pipe is a where Nuxeo events will be sent for asynchronous processing.

      Example pipe definition:
      <code>
        <eventPipe name="dummyPipe1" class="org.nuxeo.ecm.core.event.pipe.DummyPipe" priority="0">
	      <parameters>
	        <parameter name="foo">bar</parameter>
	      </parameters>
	    </eventPipe>
      </code>
    </documentation>
    <object class="org.nuxeo.ecm.core.event.pipe.EventPipeDescriptor"/>
  </extension-point>

  <extension-point name="dispatcher">
    <documentation>
      Extension point to define the dispatcher used to dispatch event between pipes.

      Example dispatcher definition:
      <code>
        <eventDispatcher name="dispatcher"
                         class="org.nuxeo.ecm.core.event.pipe.dispatch.SimpleEventBundlePipeDispatcher">
           <parameters>
             <parameter name="foo">bar</parameter>
           </parameters>
        </eventDispatcher>
      </code>
    </documentation>
    <object class="org.nuxeo.ecm.core.event.pipe.dispatch.EventDispatcherDescriptor"/>
  </extension-point>

  <extension-point name="domainEventProducer">
    <documentation>
      Extension point to define Stream Domain Event Producers.
    </documentation>
    <object class="org.nuxeo.ecm.core.event.stream.DomainEventProducerDescriptor"/>
  </extension-point>

  <extension target="org.nuxeo.ecm.core.event.EventServiceComponent" point="listener">
    <listener name="domainEventListener" async="false" priority="500"
      class="org.nuxeo.ecm.core.event.stream.DomainEventProducerListener"/>
  </extension>


</component>